home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Archive Magazine CD 1995
/
Archive Magazine CD 1995.iso
/
text
/
hints
/
volume_03
/
issue_07
< prev
next >
Wrap
Text File
|
1995-02-16
|
20KB
|
642 lines
• !Draw − I used to find it difficult to get to grips with !Draw
because I couldn’t visualise the final layout. However, if you use the
‘new view’ option together with ‘zoom’ you can get a WYSIWYG view. Not
only this, but it is possible to manipulate the major view from the
minor view. L Kennedy.
• Acorn DTP − This may seem obvious but I only just figured it out!
When printing documents from Acorn DTP, I found that footers (in
particular) wouldn’t print. I spent ages looking through the DTP manual
trying to figure out why. I suddenly occurred to me that it might be the
printer driver and sure enough, it was. The page size for A4 paper has
margins set all round, in particular a bottom margin of 20 mm is set,
and it is this which is ‘clipping’ out the footers. Set this to 0 (say)
and the problem is solved. Kevin Quinn
3.7
• BASIC programs from !Edit − When in !Edit you can actually run BASIC
programs etc from within the desktop without pressing <f12>. I happened
to come across this accidentally. Press <menu> on the Edit icon and
click on New Task Window. This will produce a task window on the screen
and will allow you to execute the BASIC environment without leaving the
desktop and allow you to format disks also allowing you to nearly multi-
task formatting disks, you can suspend the task get on with something
then resume the task and the formatter will continue where it left off!
Press-ing <menu> from within the task window will give a list of
commands (anyone know what link/unlink does??) Graham Bisset
3.7
• Changing your batteries and keeping your CMOS RAM settings intact.
If you connect a 100 microfarads capacitor in series with a 100 ohm
resistor and clip them across the battery connec-tions, (+ve of the
capacitor to +ve of the battery) you will have about 70-100 seconds to
change your batteries without losing your CMOS settings. The computer
should be kept switched off throughout the operation. J W E Jones
3.7
• Current directory path − With reference to Richard Skemp’s query in
Archive 3.5 p43 about getting the full pathname of the current direc
tory, the ‘easiest on your fingers’ method uses system variables. It was
difficult to implement and required a fair amount of digging in the
manuals but it does demonstrate the use of *Set, *SetMacro and *SetEval,
so here it is:
3.7
Place the following two lines into an Obey file, either via *Build or by
using !Edit. Save it in the library directory of your current disc as
“Path” and set the filetype to be an Obey file (*SetType %.Path Obey).
Execute it with *Path. Subsequent use of *Path will have other effects −
see later.
3.7
Set Path$ $
3.7
SetMacro Alias$Path Dir %%0||mIf “%%0” = “” Then Set Path$ $ Else If
“%%0”LEFT1 = “$” Then Set Path$ %%0 Else SetEval Path$ Path$ + “.%%0”
3.7
How it works: “Set Path$ $” sets up a system variable called “Path$” and
assigns to it the string value “$”, which you will recognise as being
the name of the root directory.
3.7
“SetMacro Alias$Path É” creates a macro system variable called “Path”.
3.7
When “*Path [<directory path>]” is executed, the macro first selects the
directory specified in <dir-ectory path> by way of the old *Dir command.
3.7
If no directory path is specified, the old *Dir selects the root
directory. The macro examines <directory path> and, if it is a null
string (“”), it sets Path$ to “$”.
3.7
If the leftmost character of <directory path> is “$”, the macro replaces
Path$ with <directory path>.
3.7
If <directory path> is not null and does not have “$” as its leftmost
character, the macro appends a full stop and the string specified in
<directory path> to whatever Path$ contains.
3.7
Path$ thus always contains the full pathname of the currently selected
directory (CSD).
3.7
You can actually redefine *Dir itself to do this, so that you don’t have
to remember to use *Path ins-tead of *Dir. In other words, it becomes
transparent.
3.7
All you do is to change the first occurrence of Path (in “Alias$Path”)
to Dir (i.e. “Alias$Dir”) and change the “Dir %%0” to “%Dir %%0”. The
extra % sign in front of Dir is to enable the original version of Dir to
be used (FORTH programmers will recognise this as smudging). I have not
actually tried this, but it should work!!
3.7
How to use it:
3.7
Use “Path” wherever you would use “Dir”. In fact, do not use “Dir” at
all (more on this later). Also use full pathnames, as opposed to
wildcarded path-names. This is not really necessary, but it looks
neater.
3.7
The command “*Path Basic.Games.Adventure”, executed from the root
directory, would set sub-directory “Adventure” as the CSD, exactly in
the same way as “*Dir Basic.Games.Adventure” would do.
3.7
Notes:
3.7
1. No leading asterisks. You may enter them, but they are superfluous,
as these lines are sent direct to the CLI.
3.7
2. The use of two double bar characters in ||m. This is so that Obey
will insert it in the macro variable as |m, instead of as ASCII 13.
3.7
Alias$Path is a multi-line (well, a 2-line) com-mand. This is quite
acceptable, provided each line is separated by a carriage return (ASCII
13, or |m).
3.7
Note that the (*)Dir command is at the start of the macro. Putting it
at the end causes errors related to the (*)IfÉThenÉElse construct.
3.7
3. Double percentage character in %%0. This is so that Obey will insert
it in the macro variable as %0, instead of attempting to evaluate a
(non-existent) parameter when the command *SetMacro is executed.
3.7
4. Double quote marks where the parameter is to be evaluated as a
string. This is so that string evaluation will proceed correctly.
3.7
5. Use of upper and lower case. In general they are interchangeable at
will.
3.7
(*)Eval supports a number of operators (see p.394 in the Archimedes User
Guide). Some are in the form of ordinary words, such as LEFT, MOD, AND,
OR, etc, and others are symbols, such as *, +, >>, etc. The ordinary
words must be in UPPER CASE, otherwise they are not recognised.
3.7
Disc-related commands seem to be quite happy when offered system
variables as pathnames. If an application sets up its own pathname as,
say, “Application$Dir”, you can make the first line of a BASIC program.
3.7
10 REM > <Application$Dir>.Program
3.7
and be confident that the BASIC command SAVE will put it in the right
place, as the Filer (I think) evaluates <Application$Dir> correctly.
Also *Eval Application$Dir (without the <>) also returns the value of
the variable.
3.7
You can get the value of the system variable into a BASIC variable with
the following FN:
3.7
buffer_length%=255
3.7
DIM buffer% buffer_length%
3.7
PRINT FNevalOS(“Application$Dir”) : REM NB!! no < >
3.7
END
3.7
3.7
DEF FNevalOS(A$) LOCAL T%,L%
3.7
SYS “OS_EvaluateExpression”, A$,buffer%,buffer_length% TO ,T%,L%
3.7
IF T%=0 THEN = L% : REM integer result
3.7
buffer%?L%=13
3.7
=$buffer% : REM string result
3.7
Anton Mans, Durban
3.7
• Double height in Fortran − The following short FORTRAN routine can
be used for the Archimedes to ‘tart up’ screen output. It is a routine
for printing text in double height on the screen and uses OS_Word call
10 to read the system font bit pattern. A VDU23 call is used to define a
pair of characters consisting of the upper and lower halves of the input
character. These two characters are then printed, one above the other,
giving a double-height character. It’s very useful for printing headings
in screen output and doesn’t require messing about with special fonts
(I’m going to go on to that next!).
3.7
I claim no originality for the overall method. A routine in BBC BASIC to
do this was published in Beebug some years ago (I forget who the author
was), but I thought it was worth publicising a FORTRAN version of it in
Archive because I don’t think the translation is immediately obvious and
readers may not have been aware of the technique anyway. It should be
easily extendible to double width, quadruple height, etc.
3.7
Rather than just give the bare routine, I have produced a short program
incorporating it, that writes out a couple of strings. Much use is made
of the ‘$’ format to suppress CRLF when characters are being sent to the
VDU driver. The routine is more complex than the BASIC equivalent for
two reasons. Firstly, although there is a word ‘LEN’ in FORTRAN, it only
seems to give the maximum length of any given string, i.e. the length
that it is originally declared to be (e.g. CHARACTER*78 TXT; LEN(TXT)
gives 78). So in SUBROUTINE DOUBLE, there are a few lines to find the
length of the string passed to it by counting backwards from the maximum
length until a non-space character is reached. N.B. this will fail if
the string is put into the argument list, e.g. CALL DOUBLE(10,20,‘Hi
there’). Secondly, since individual bytes in memory are not accessible
to FORTRAN, you have to get the result back as three (4-byte) integers,
and use IAND with ISHFT to gain access to the bytes.
3.7
PROGRAM DHTEST
3.7
C *******************************
3.7
C A DEMONSTRATION PROGRAM FOR
3.7
PRINTING DOUBLE HEIGHT
3.7
C TEXT IN ANY MODE (NOT 7) ON THE
3.7
ACORN ARCHIMEDES,
3.7
C IN ACORNSOFT FORTRAN. USES ACORN
3.7
EXTENSIONS: OSWORD, ISHFT, IAND
3.7
C BY R.D.WRIGHT
3.7
C *******************************
3.7
CHARACTER*78 TXT
3.7
WRITE(6,’($,2A)’)CHAR(22)
3.7
,CHAR(12)
3.7
WRITE(6,*)’DOUBLE HEIGHT TEST’
3.7
TXT=’THIS IS A VERY LONG TEST
3.7
STRING’
3.7
CALL DOUBLE(10,20,TXT)
3.7
TXT=‘AND MORE’
3.7
CALL DOUBLE(10,23,TXT)
3.7
STOP ‘END OF DEMO’
3.7
END
3.7
SUBROUTINE DOUBLE(ICOL,IROW,TXT)
3.7
CHARACTER*78 TXT
3.7
INTEGER BLOCK(0:2)
3.7
INTEGER B(0:8)
3.7
N=79
3.7
10 N=N-1
3.7
IF (TXT(N:N).EQ.‘ ’) GO TO 10
3.7
DO 20 I=1,N
3.7
BLOCK(0)=ICHAR(TXT(I:I))
3.7
CALL OSWORD(10,BLOCK)
3.7
DO 2010 J=1,3
3.7
BLOCK(0)=ISHFT(BLOCK(0),-8)
3.7
B(J)=IAND(BLOCK(0),?IFF)
3.7
2010 CONTINUE
3.7
B(4)=IAND(BLOCK(1),?IFF)
3.7
DO 2020 J=5,7
3.7
BLOCK(1)=ISHFT(BLOCK(1),-8)
3.7
B(J)=IAND(BLOCK(1),?IFF)
3.7
2020 CONTINUE
3.7
B(8)=IAND(BLOCK(2),?IFF)
3.7
WRITE(6,‘($,10A)’)CHAR(23),CHAR(
3.7
240),CHAR(B(1)),CHAR(B(1))
3.7
+,CHAR(B(2)),CHAR(B(2)),CHAR(B(3
3.7
)),CHAR(B(3)),
3.7
+CHAR(B(4)),CHAR(B(4))
3.7
WRITE(6,‘($,10A)’)CHAR(23),CHAR(
3.7
241),CHAR(B(5)),CHAR(B(5))
3.7
+,CHAR(B(6)),CHAR(B(6)),CHAR(B(7
3.7
)),CHAR(B(7))
3.7
+,CHAR(B(8)),CHAR(B(8))
3.7
IX=ICOL+I-1
3.7
IYU=IROW
3.7
IYL=IROW+1
3.7
WRITE(6,‘($,8A)’)CHAR(31),CHAR(
3.7
IX),CHAR(IYU),CHAR(240)
3.7
+,CHAR(31),CHAR(IX),CHAR(IYL)
3.7
,CHAR(241)
3.7
20 CONTINUE
3.7
RETURN
3.7
END
3.7
R.D.Wright
3.7
• Easy ‘C’ Compilation I − While working on a C program it can become
quite tedious to type in the same parameters every time you want to
compile the latest version of your program. One way to get around this
is to use something like “C-Front” from Mitre which allows you to
compile directly from the desktop. A simpler and cheaper way is to use
an ‘Obey’ file which will do the job for you. Below is an example that
has been written to make the compilation of C (Release 3) programs
easier. Using this method, you can still work from the desktop editing
your text in !Edit, saving it, then pressing <f12>. You can then use the
following command:
3.7
*c <inputname> [outputname]
3.7
It will then automatically Compile and Link your new masterpiece!
3.7
The program has been fully commented to aid understanding. It should be
saved as an ‘Obey’ file in the ‘Library’ directory under the name “C”.
Obviously it should be customised to suit your own directory layout and
preferred compiler options.
3.7
| ‘C’ Obey file, Compiler & Linker -
3.7
16/02/90 Mark Taylor
3.7
| Syntax : “*C <inputname> [output
3.7
name]“
3.7
| Where ‘inputname’ is the name of
3.7
the file to be compiled
3.7
| and ‘outputname’ is the name of the
3.7
output file, e.g. !RunImage, etc.
3.7
|
3.7
| Check for parameters. If none
3.7
present then error and output
3.7
a message.
3.7
if “%0” = “” then error 0 Error in
3.7
‘C’ Compiler & Linker. Syntax : *C |<inputname|> [outputname]
3.7
|
3.7
| Set system variable ‘ipname$’ to
3.7
first parameter after the “c”.
3.7
Set ipname$ %0
3.7
|
3.7
| Check for a second and if there is
3.7
one set ‘opname$’ to that
3.7
variable,
3.7
| else set ‘opname$’ equal ‘ipname$’.
3.7
If “%1” > “” then Set opname$ %1 else
3.7
Set opname$ %0
3.7
|
3.7
| Compile with ‘ipname$’, do NOT Link
3.7
(-c). ANSI 3 Standard method.
3.7
cc -c <ipname$> -I$.RISC-OSLib
3.7
|
3.7
| Link ‘ipname$’ with standard lib-
3.7
raries and output as ‘opname$’.
3.7
link -o <opname$> o.<ipname$> $.RISC
3.7
-OSLib.o.RISC-OSLib $.CLib.o.Stubs
3.7
|
3.7
| Echo finishing message.
3.7
Echo File ‘<ipname$>’ successfully
3.7
compiled as ‘<opname$>’.
3.7
| Unset the temporary variables.
3.7
Unset ipname$
3.7
Unset opname$
3.7
Below is a cut down version that is not quite as sophisticated but is
easier to understand.
3.7
| ‘C’ Obey file, Compiler & Linker -
3.7
16/02/90 Mark Taylor
3.7
| Syntax : “*C name” Where ‘name’ is
3.7
the name of the file to be
3.7
compiled.
3.7
cc -c %0 -I$.RISC-OSLib
3.7
link -o %0 o.%0 $.RISC-OSLib.o.RISC
3.7
-OSLib $.CLib.o.Stubs
3.7
Echo File ‘%0’ successfully compiled.
3.7
3.7
• Easy ‘C’ Compilation II − This is not a new idea but it is still
worth mentioning. To speed up the compilation of ‘C’ programs it is a
good idea to copy the necessary files to a RAM disc. I have written an
Obey file to achieve this. It is best saved into the Library directory
so that it may be called from the star (*) prompt any time. The way the
file is set up at the moment means that it will copy files from the hard
disc to a RAM disc of some 1.5M. The RAM disc is set up using the
“MemAlloc” module (this can be found in the !Lander directory on the
Apps2 disc of RISC-OS). It should be copied in the mod-ules directory of
the !System folder. The directory layout reflects a fairly standard
system under release 3 of Acorn’s ANSI C.
3.7
Important!
3.7
You must remember to copy the files you have changed during your session
back to disc before switching off!
3.7
| Obey file to set up RAM disc as the
3.7
working disc for ‘C’ 18/1/90
3.7
|
3.7
| First create large RAM disc: 1.5MB!
3.7
RMensure MemAlloc 0.11 RMload :4.$.
3.7
!System.modules.memalloc
3.7
RAMFSSize 1500
3.7
RMensure SharedClibrary 3.50 RMload
3.7
:4.$.!System.modules.clib
3.7
RMensure FPEmulator 2.80 RMload :4.$.
3.7
!System.modules.FPE280
3.7
|
3.7
CDir RAM:$.RISC-OSlib
3.7
CDir RAM:$.Clib
3.7
CDir RAM:$.User
3.7
Copy ADFS:$.RISC-OSlib.* RAM:$.RISC-
3.7
OSlib.* ~cr~v
3.7
Copy ADFS:$.CLib.* RAM:$.Clib.* ~cr~v
3.7
Copy ADFS:$.User.* RAM:$.User.* ~cr~v
3.7
CDir RAM:$.Library
3.7
Copy ADFS:$.Library.link RAM:$.Library.* ~c~v
3.7
Copy ADFS:$.Library.cc RAM:$.Library.* ~c~v
3.7
Copy ADFS:$.Library.squeeze RAM:$.Library.* ~c~v
3.7
| Copy my single letter Obey file ‘C’.
3.7
Copy ADFS:$.Library.c RAM:$.Library
3.7
.* ~c~v
3.7
|
3.7
|Define function keys.
3.7
k.1c
3.7
k.2cc -c
3.7
k.3-I$.RISC-OSLib
3.7
k.4link -o
3.7
k.5$.RISC-OSLib.o.RISC-OSLib
3.7
k.6$.CLib.o.Stubs
3.7
k.7Squeeze -v
3.7
| Delete all unwanted object files!
3.7
k.12wipe o.* ~c
3.7
|Perform *RAM at the end!
3.7
RAM
3.7
|Select $.User directory!
3.7
Dir $.User
3.7
Echo RAM Disc now setup correctly
3.7
(DIR=$.User)
3.7
Echo
3.7
free
3.7
Filer_OpenDir RAM:$.User.c
3.7
• Music Maestro please! − The !Maestro applic-ation provided by Acorn
is very powerful, if very complex. However, it still has a number of
short-comings relative to the old Island Logic’s “Music System” for the
BBC micro. These include the inability to delete whole bars or several
bars; the inability to handle triplets; the inability to change Tempo
within a passage. Also, entering scores by dragging icons is extremely
slow and laborious and finally, “Music System” counted notes in a bar
and, when the right time had been used, automatically entered a bar-
line. This not only saved an operation, it also provided a cross-check
on typing accuracy: the unexpected appearance of a bar-line indicated a
mistake somewhere.
3.7
!Maestro’s !RunImage file has been modified to permit changing of the
Tempo during a passage. This required a new sprite, placed in the space
in the top right corner, next to the hemi-demi-semi-quaver rest; ‘M’ for
Metronome seemed to be a reasonable choice. This sprite can be picked
up, just like the others, and placed above the appropriate bar-line.
When it is ‘clicked’ to fix it in position, it changes into the crotchet
symbol followed by “=<num>”, where <num> is a number from 40 to 210,
representing the Tempo as selected by the Tempo sub-menu from the main
Maestro menu. The numbers (of beats per minute) are given on page 1810
of the Programmer’s Reference Manual.
3.7
During these investigations, a few small errors were noticed in the
Programmer’s Reference Manual (RISC-OS Edition). In Vol.4, under Music
Files:
3.7
p.1809 “Maestro” is followed by “Line-feed”, &0A (not &0D)
3.7
Music Data: Not “4*8 length of queue of notesÉ” but “5*8” because the
length is written to file as an integer variable, FINE%(C%) (as in DC al
fine!), so it consists of one byte (&40:integer) followed by 4 bytes
(value).
3.7
p.1811 Attributes: Clef Bit 5 is unused Bits 6 & 7 are (Stave−1), range
0−3. The attributes as defined in !Maestro. !RunImage lines 28900−29020
agree with those obtained by a *DUMP of a Music file. Alan Quayle
3.7
• Shift Caps Lock will give you capitals normally but will enable
lower case characters to be typed by holding down the shift key − very
useful when writing BASIC programs. Fred Lee
3.7
• SID − There is a mail-server on the SID database and so if you can
use E-MAIL (e.g. if you are a student at University, like me) then you
can mail it at SIDInfo@uk.co.acorn with a message contain-ing the word
‘help’ and it will mail you a file telling you how to download stuff.
It only has the free PD stuff though (obviously). The advantages of this
service work both ways − the SID machine can schedule the replies in
non-peak times and you are not using lots of on-line time down-loading.
Kevin F. Quinn
3.7
• TinyDirs − it may be obvious to most of you butÉ The TinyDirs
program not only allows directories to be installed on the icon bar but
allows applications to be as well. After all they are only directories
really. The application can then be run by clicking on the icon on the
icon bar in just the same way as any other application. This means you
can have your favourite programs on the icon bar without having to worry
about how to install them there. The TinyDirs program will also cope
with more than one directory. (A friend was running a new copy of
TinyDirs each time he wanted a new directory installed.) If you just
drag the icon for the directory you want installed onto one of those
already there it will be added to the list. Andrew Ling.
3.7
• Turkish ‘i’ − There is a minute error in the char-acter set supplied
as “Latin3” on the Archimedes which, according to Acorn’s manual,
corresponds to ISO 8859/3 covering German, Spanish, Turkish etc.
Character 185 is supposed to be the Turkish lower case ‘i’, i.e. like
the English ‘i’ but without the dot. (The Mac has let me down for once −
no Turkish ‘i’! Ed.) Instead, it replicates the standard Latin ‘i’.
3.7
To overcome this, insert the following in a boot file:
3.7
*echo <23><185><0><0><56><24><24>
3.7
<24><60><0>
3.7
John Morgan
3.7
• Working on a 1Mbyte machine − When loading applications within the
desktop especially on a 1Mb machine, always call up the task display and
reduce the size of the next slot to as low as the machine will allow,
some applications will allow you to set it to 8k and they will just grab
as much memory as they need, however some will report ‘App need XXXk to
start’ so change the slot to about XXX+20k for workspace. If you do this
then the application can only grab as much memory as it needs. However,
if you leave say 640k in the next and you click on an application then
its likely that the application will grab about 600k or so leaving
precious little for other programs, data etc Users of 2Mb+ machines
don’t have the problem, but they still need to be careful of memory
grabbing applications! Graham Bisset
3.7